import axios from 'axios';
// import { UserState } from '@/store/modules/user/types';
import { ajaxService } from '@/utils/request';
import { getToken } from '@/utils/auth';

const env = import.meta.env;
let baseURL = env.VITE_BUY_URL;
let userURL = env.VITE_USER_BASE_URL;

// 生成二维码
export function postBarcodeAdd(data: any) {
  return ajaxService({
    url: '/basis/barcode/add',
    data,
    method: 'post',
    baseURL: userURL,
  });
}

// 根据订单id查询条码列表
export function getBarcode(params: any) {
  return ajaxService({
    url: '/basis/barcode/getAll',
    params,
    method: 'get',
    baseURL: userURL,
  });
}

// 删除条码
export function delarcode(params: any) {
  return ajaxService({
    url: '/basis/barcode/delete',
    params,
    method: 'delete',
    baseURL: userURL,
  });
}

// 根据订单编号获取对应未入库的条码
export function getProductAndBarcode(params: any) {
  return ajaxService({
    url: '/basis/purchase/list/getProductAndBarcode',
    params,
    method: 'get',
    baseURL,
  });
}
